﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Util.Rand
{
    public class RandomUtility
    {
        private static Random Random { get; set; }

        static RandomUtility()
        {
            Random = new Random();
        }

        public static int RandomPositiveInteger()
        {
            Random random = Random;
            lock (random)
            {
                return random.Next();
            }
        }

        public static int RandomPositiveInteger(int scope)
        {
            Random random = Random;
            lock (random)
            {
                return random.Next(scope);
            }
        }

        public static double RandomDouble()
        {
            Random random = Random;
            lock (random)
            {
                return Random.NextDouble();
            }
        }
    }
}
